﻿using System;
using System.CodeDom.Compiler;

namespace FBGraph.ClientGenerator.CodeGen
{
    public class XmlDocComment : CodeGenObject
    {
        public XmlDocComment(String comment)
        {
            this.Text = comment;
        }

        public XmlDocComment(String format, params Object[] args)
        {
            this.Text = String.Format(format, args);
        }

        public String Text { get; set; }

        public override void Write(CodeGenWriter writer)
        {
            writer.WriteLine("/// {0}", this.Text);
        }

        public override Boolean Equals(Object obj)
        {
            var that = obj as XmlDocComment;
            if (that == null) return false;
            else return
                this.Text == that.Text;
        }

        public override Int32 GetHashCode()
        {
            return this.Text.GetHashCode();
        }
    }
}